package com.design.pattern.proxy.cglib;

import org.springframework.cglib.proxy.MethodInterceptor;
import org.springframework.cglib.proxy.MethodProxy;

import java.lang.reflect.Method;

public class CglibMethodInterceptor implements MethodInterceptor {
    @Override
    public Object intercept(Object obj, Method method, Object[] args, MethodProxy methodProxy) throws Throwable {
        System.out.println(">>cglib日志收集开始<<");
        Object result = methodProxy.invokeSuper(obj, args);
        System.out.println(">>cglib日志收集结束<<");
        return result;

    }
}
